package com.heeexy.example.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.heeexy.example.dao.ThingDao;
import com.heeexy.example.service.ThingService;
import com.heeexy.example.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class ThingServiceImpl implements ThingService{

    @Autowired
    private ThingDao thingDao;

    /**
     * 新增文章
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public JSONObject addThing(JSONObject jsonObject) {
        thingDao.addThing(jsonObject);
        return CommonUtil.successJson();
    }

    /**
     * 文章列表
     */
    @Override
    public JSONObject listThing(JSONObject jsonObject) {
        List<JSONObject> list = thingDao.listThing(jsonObject);
        return CommonUtil.successPage(list);
    }





}
